#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "InteractionFragment.h"
#include "NamedElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Gate;
class Interaction;
class Property;
class ValueSpecification;

/// <summary>
/// InteractionUse
/// An InteractionUse refers to an Interaction. The InteractionUse is a shorthand
/// for copying the contents of the referenced Interaction where the InteractionUse
/// is. To be accurate the copying must take into account substituting parameters
/// with arguments and connect the formal Gates with the actual ones.
/// </summary>
class UMLMODEL_EXPORT InteractionUse : public NamedElement, public InteractionFragment {

public: // Constructors and destructors
    explicit InteractionUse(const QString& umlType="uml::InteractionUse");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// actualGates getter
    /// The actual gates of the InteractionUse.
    /// </summary>
    vector<shared_ptr<Gate>>& actualGates();

    /// <summary>
    /// arguments getter
    /// The actual arguments of the Interaction.
    /// </summary>
    vector<shared_ptr<ValueSpecification>>& arguments();

    /// <summary>
    /// refersTo getter
    /// Refers to the Interaction that defines its meaning.
    /// </summary>
    shared_ptr<Interaction> refersTo() const;

    /// <summary>
    /// refersTo setter
    /// Refers to the Interaction that defines its meaning.
    /// </summary>
    void setRefersTo(shared_ptr<Interaction> value);

    /// <summary>
    /// returnValue getter
    /// The value of the executed Interaction.
    /// </summary>
    shared_ptr<ValueSpecification> returnValue() const;

    /// <summary>
    /// returnValue setter
    /// The value of the executed Interaction.
    /// </summary>
    void setReturnValue(shared_ptr<ValueSpecification> value);

    /// <summary>
    /// returnValueRecipient getter
    /// The recipient of the return value.
    /// </summary>
    shared_ptr<Property> returnValueRecipient() const;

    /// <summary>
    /// returnValueRecipient setter
    /// The recipient of the return value.
    /// </summary>
    void setReturnValueRecipient(shared_ptr<Property> value);

private: // Fields
    /// <summary>
    /// actualGates
    /// The actual gates of the InteractionUse.
    /// </summary>
    vector<shared_ptr<Gate>> actualGates_;

    /// <summary>
    /// arguments
    /// The actual arguments of the Interaction.
    /// </summary>
    vector<shared_ptr<ValueSpecification>> arguments_;

    /// <summary>
    /// refersTo
    /// Refers to the Interaction that defines its meaning.
    /// </summary>
    shared_ptr<Interaction> refersTo_;

    /// <summary>
    /// returnValue
    /// The value of the executed Interaction.
    /// </summary>
    shared_ptr<ValueSpecification> returnValue_;

    /// <summary>
    /// returnValueRecipient
    /// The recipient of the return value.
    /// </summary>
    shared_ptr<Property> returnValueRecipient_;

};

} // namespace uml
